#pragma once
#include <fstream>
#include <algorithm>

class my_container
{
private:
   size_t size_;
   size_t capacity_;
   union 
   {
      int first_digit_;
      int *digits_;
   } data_;

   void check_capacity(size_t);
   void shrink();
   void expand();
   void copy_data(int* dest, const int* source, size_t length);


public:
   my_container();
   my_container(const my_container&);
   my_container(size_t, int);

   my_container & operator = (const my_container&);
   int & operator[](size_t);
   const int & operator[](size_t) const;

   size_t size() const;
   size_t capacity() const;
   int& back();
   const int& back() const;
   void resize(size_t);
   void push_back(int);
   void pop_back();
   void swap(my_container &);
   void reverse(); 
   
   friend std :: ofstream & operator <<(std :: ofstream&, const my_container&);
};